<div class="setting">
    <?php include PROJECT_PATH . 'Application/Web/View/Setting/menu.tpl.php';?>
    <div class="right">
		<?php foreach ($comments as $comment){?>
		<div class="comment">
			<div class="info">
    			<span class="name"><?=$comment['comment_member_nickname']?></span>
    			<span><?=Web_Model_Common::getFormatTime($comment['comment_time'])?></span>
    			<span>
    			    <?php 
    			        if($comment['comment_type'] == 0)
    			        {
    			            echo '待发布';
    			        }
    			        else if($comment['comment_type'] == 1)
    			        {
    			            echo '已发布';
    			        }
    			        else  if($comment['comment_type'] == 2)
    			        {
    			            echo '已删除';
    			        }
    			        else
    			        {
    			            echo '异常';
    			        }
    			    ?>
    			</span>
    			<?php if($comment['comment_type'] != 1){?>
    			<span onclick="setType(<?=$comment['comment_id']?>, 1)" class="btn">发布</span>
    			<?php }else{ ?>
    			<span onclick="setType(<?=$comment['comment_id']?>, 2)" class="btn">删除</span>
    			<?php }?>
    			<span><a target="_blank" href="http://<?=HOST?>/blog/detail/id/<?=$comment['comment_article_id']?>">查看原文</a></span>
			</div>
			<div class="content html"><?=$comment['comment_content']?></div>
		</div>
		<?php }?>
		<?php if(empty($comments)){ ?>
		<div>暂无评论</div>
		<?php }else{?>
		<div class="page">
    		<span><a href="http://<?=HOST?>/setting/comment/page/<?=$pageNav['firstPage']?>">[首页]</a></span>
    		<span><a href="http://<?=HOST?>/setting/comment/page/<?=$pageNav['prePage']?>">[上一页]</a></span>
    		<?php foreach ($pageNav['pageList'] as $pageNum){ ?>
    		<span><a href="http://<?=HOST?>/setting/comment/page/<?=$pageNum?>">[<?=$pageNum?>]</a></span>
    		<?php }?>
    		<span><a href="http://<?=HOST?>/setting/comment/page/<?=$pageNav['nextPage']?>">[下一页]</a></span>
    		<span><a href="http://<?=HOST?>/setting/comment/page/<?=$pageNav['lastPage']?>">[尾页]</a></span>
    	</div>
    	<?php }?>
    </div>
</div>
<script type="text/javascript">
    function setType(id, type)
    {
        if(type == 2){if(!confirm("确定删除？")) return;}
    	$.ajax({
    		  url: "http://<?=HOST?>/setting/setCommentTypeAjax",
    		  cache: false,
    		  timeout:10000,
    		  type: "POST",
    		  data: {
    			  comment_id:id,
    			  comment_type:type
    		  },
    		  dataType: "json",
    		  beforeSend: function() {
    			  disableHTML(true, '请稍等，处理中……', true);
    		  },
    		  success: function(data) {
    			  if(data.errCode != 0){
    				disableHTML(true, data.errMsg, false);
    	  			setTimeout(disableHTML,2000);
    			  }else{
    				disableHTML(true, '提交成功，跳转中……', true);
    				setTimeout("location.href = 'http://<?=HOST?>/setting/comment/page/<?=$pageNav['nowPage']?>'",2000);
    			  }
    		  },
    		  error:function(){
        			disableHTML(true, "请求出错，请重试", false);
        			setTimeout(disableHTML,2000);
        		}
    		});
    }
</script>